﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.SessionState;
using System.Data;

namespace AjaxLibrary
{
    class order : IHttpHandler, IRequiresSessionState
    {
        #region IHttpHandler 成员

        bool IHttpHandler.IsReusable
        {
            get { return true; }
        }

        void IHttpHandler.ProcessRequest(HttpContext context)
        {

            StringBuilder csv = new StringBuilder();

            DataTable dt = logic.order.listWithCollect(logic.customer.getCompanyId());
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    csv.AppendFormat("{0}-{1};{2};{3:F2};{4:F2}\n", row["year"], row["month"], row["orderCount"], row["amount"], row["budgetFee"]);
                }

                context.Response.Output.Write(csv.ToString());
            }
            else
            {
                context.Response.Output.Write(" ");
            }
           
        }

        #endregion
    }
}
